#ifndef __G_RINGBUF_H__
#define __G_RINGBUF_H__
#include "g_type.h"
#include "g_1903.h"
typedef unsigned long G_RingBuf_Size_t; 


struct _RingBuf_TyperDef
{
    struct _RingBuf_TyperDef *pRingBuf; 
    uint8_t *RingBufPool;
    G_RingBuf_Size_t BufSize;
    G_RingBuf_Size_t WPtr;
    G_RingBuf_Size_t RPtr;    
};
typedef struct _RingBuf_TyperDef G_RingBuf_TyperDef;
typedef struct _RingBuf_TyperDef * G_pRingBuf_TyperDef;

struct RingBuf_Func_TyperDef
{
    G_Boolean (*put)(struct _RingBuf_TyperDef *pRingBuf,uint8_t *buf,G_RingBuf_Size_t len);
    G_Boolean (*get)(struct _RingBuf_TyperDef *pRingBuf,uint8_t *buf,G_RingBuf_Size_t len);
    G_Boolean (*IsEmpty)(struct _RingBuf_TyperDef *pRingBuf);
    G_Boolean (*IsFull)(struct _RingBuf_TyperDef *pRingBuf);
    G_RingBuf_Size_t (*GetDataLen)(struct _RingBuf_TyperDef *pRingBuf);
    G_Boolean (*GetTry)(struct _RingBuf_TyperDef *pRingBuf,uint8_t *buf,G_RingBuf_Size_t len);
    G_Boolean (*PutTry)(struct _RingBuf_TyperDef *pRingBuf,uint8_t *buf,G_RingBuf_Size_t len);
};

G_pRingBuf_TyperDef G_RingBufCreat(uint8_t *baseAddr, G_RingBuf_Size_t size);
extern const struct RingBuf_Func_TyperDef RingBuf_Func;
#endif
